package com.naiterui.ehp.bs.pharmacist.repository.mysql;

import java.util.Date;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.naiterui.common.repository.core.BaseJpaRepository;
import com.naiterui.ehp.bs.pharmacist.entity.Pharmacist;

/**
 * @Description 药师数据接口
 * @Author gongbaoqiang
 * @Date 2019/12/2 12:54 PM
 */
@Repository
public interface PharmacistRepository extends BaseJpaRepository<Pharmacist, Long> {

    /**
     * 根据您手机号查询
     *
     * @param phone
     *
     * @return
     */
    Pharmacist findFirstByPhone(String phone);

    /**
     * 根据您手机号和身份证号查询
     *
     * @param phone
     * @param cardNo
     *
     * @return
     */
    Pharmacist findFirstByPhoneAndCardNo(String phone, String cardNo);

    /**
     * 根据密码盐判断是否存在记录
     *
     * @param salt
     *
     * @return
     */
    boolean existsBySalt(String salt);

    List<Pharmacist> findAllByStatusAndAuthStatusAndAccountStatus(Integer status, Integer authStatus, Integer accountStatus);

    List<Pharmacist> findByIdIn(List<Long> pharmacistIds);

    List<Pharmacist> findByAuthStatusAndChangedAtBetween(Integer authStatus, Date startDate, Date endDate);

    /**
     * 根据您手机号或身份证号查询
     *
     * @param phone
     * @param cardNo
     *
     * @return
     */
    List<Pharmacist> findByPhoneOrCardNo(String phone, String cardNo);

    /**
     * 根据您手机号或身份证号查询
     *
     * @param phone
     * @param cardNo
     *
     * @return
     */
    Pharmacist findFirstByPhoneOrCardNo(String phone, String cardNo);

}
